#include<iostream>
#include<signal.h>
using namespace std;
/* void handler(int signum)
{
    std::cout<<"get a sig:"<<signum<<std::endl;
    exit(1);
}
int main ()
{
    struct sigaction act,oact; 
    act.sa_handler=handler;
    sigemptyset(&act.sa_mask);
    act.sa_flags=0;
    sigaction(2,&act,&oact);
    //sigaction(2,)
    while(true)
    {
        std::cout<<"I am a process, pid :"<<getpid()<<std::endl;
        sleep(1);
    }
    return 0;
} */
void changedata(int signo)
{
    cout<<"get a signo:"<<signo<<"change gfilag 0->1"<<std::endl;
    return ;
}
int gfilag=0;
int main ()
{
    signal(2,changedata);
    while (!gfilag);
    std::cout<<"process quit normal"<<std::endl;

}